--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.

--This SQL is generated for the model defined view [Listingdisplayview]

if exists(select * from sys.objects where name = 'Listingdisplayview' and type = 'V' and type_desc = 'VIEW')
drop view [dbo].[Listingdisplayview]
--MODELID: b53df47a-b6dd-4769-b67e-9e9e0ca1693a
GO

CREATE VIEW [dbo].[Listingdisplayview]
AS

select 
    A.listingid,
    A.active,
    A.cylinders,
    A.description,
    A.doors,
    A.engine,
    A.expirationdate,
    A.listdate,
    A.mileage,
    A.price,
    A.title,
    A.trimlevel,
    A.vin,
    A.year,
    BT.name as bodytype,
    C.name as conditiontype,
    F.name as fueltype,
    MK.name as [make],
    ML.name as [model],
    MT.name as [metro],
    T.name as [transmissiontype],
    MK.makeid,
    ML.modelid
from LISTING A inner join BODYTYPE BT on A.bodytypeid = BT.bodytypeid
    left outer join CONDITION C on A.conditionid = C.conditionid
    left outer join FUELTYPE F on A.fueltypeid = F.fueltypeid
    left outer join MAKEMODEL MM on A.makemodelid = MM.makemodelid
    left outer join MAKE MK on MM.makeid = MK.makeid
    left outer join MODEL ML on MM.modelid = ML.modelid    
    left outer join METRO MT on A.metroid = MT.metroid
    left outer join TRANSMISSION T on A.transmissionid = T.transmissionid

--MODELID,BODY: b53df47a-b6dd-4769-b67e-9e9e0ca1693a
GO
exec sp_refreshview N'[dbo].[Listingdisplayview]';
--MODELID: b53df47a-b6dd-4769-b67e-9e9e0ca1693a
GO

